package cn.tedu.spring.autowired.controller;

import cn.tedu.spring.autowired.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Controller;

@Controller
public class UserController {
//    Autowired 默认指定类型
    @Autowired
    @Qualifier(value = "userServiceImp2")
    private UserService userService;

//    @Autowired
    public void setUserService(UserService userService){
        this.userService=userService;
    }

//    @Autowired
//    public UserController(UserService userService){
//        this.userService = userService;
//    }

    public void con(){
        System.out.println("controller正在执行..");
        userService.serv();
    }
}
